package com.nexus.all.manager;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nexus.all.dao.CommentViewMapper;
import com.nexus.all.model.CommentView;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CommentViewManager extends ServiceImpl<CommentViewMapper, CommentView> {

    /**
     * 根据评论dataId查询
     *
     * @param commentDataId
     * @param commentType
     * @return
     */
    public CommentView getByCommentDataId(Long commentDataId, Byte commentType) {
        LambdaQueryWrapper<CommentView> wrapper = CommentView.gw();
        wrapper.eq(CommentView::getCommentDataId, commentDataId);
        wrapper.eq(CommentView::getCommentType, commentType);
        return getOne(wrapper);
    }
}
